using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UIDesigner
{
  class CtrlDataMaker
  {
    public static string OutDetails(Control.ControlCollection cc)
    {
      string str = "";
      int i = 0;
      foreach (Control c in cc)
      {
        str += "種類=" + CtrlSrcMaker.ControlString(c) + ",";
        str += "Name=" + c.Name + ",Text=" + c.Text;
        str += ",Left=" + c.Left + ",Top=" + c.Top + ",Right=" + c.Right + ",Bottom=" + c.Bottom;
        str += "\r\n";
        i++;
      }
      str += "\r\n合計＝" + i;

      return str;
    }

    public static string OutNormal(Control.ControlCollection cc)
    {
      string str = "";
      int i = 0;
      foreach (System.Windows.Forms.Control c in cc)
      {
        str += CtrlSrcMaker.ControlString(c) + ",";
        str += c.Name + " - " + c.Text;
        str += "(" + c.Left + "," + c.Top + ")-(" + c.Right + "," + c.Bottom + ")";
        if (c is TextBox)
        {
          TextBox t = (TextBox)c;
          str += "," + t.TabIndex;
        }
        else if (c is Label)
        {
          Label l = (Label)c;
          if (l.Font.Bold) str += "Bold";
        }
        str += "\r\n";
        i++;
      }
      str += "\r\n合計＝" + i;

      return str;
    }

    public static string OutCSV(Control.ControlCollection cc)
    {
      string str = "";
      int i = 0;
      foreach (Control c in cc)
      {
        str += CtrlSrcMaker.ControlString(c) + ",";
        str += c.Name + "," + c.Text;
        str += "," + c.Left + "," + c.Top + "," + c.Right + "," + c.Bottom + ",";
        if (c is TextBox)
        {
          TextBox t = (TextBox)c;
          str += t.TabIndex;
        }
        else if (c is Label)
        {
          Label l = (Label)c;
          if (l.Font.Bold) str += "Bold";
        }
        str += "\r\n";
        i++;
      }

      return str;
    }
  }
}
